< previous page page_43 next page >

Page 43
8694cbadb9b1ef7075903f6f95fc1db2.gif
 9:
10:  Set the file path for the animation file
11:  Set the from and to file copy paths
12:     strAvi_Filename = c:\program_
      files\devstudio\vb\graphics\avis\filecopy.avi
13:     strFrom_filename = c:\temp\Testfile.exe
14:     strTo_filename = d:\temp\Testfile.exe
15:
16:  If the destination file exists, ask the user if they
17:  want to continue
18:     If Dir(strTo_filename) <>  Then
19:         If MsgBox(strTo_filename & vbCrlf & _
20:              already exists. Copy over old file?, vbOKCancel) = _
                vbCancel Then
21:             Exit Sub
22:         End If
23:     End If
24:
25:  Get the size of the file to copy
26:  and calculate the number of times to loop
27:  the copy routine based on moving 256 bytes at a time
28:     lngFileSize = FileLen(strFrom_filename)
29:     intBufferCount = lngFileSize / 256
30:
31:  Set the progressbar min and max properties
32:     prgStatus.Min = 1
33:     prgStatus.Max = i + intBufferCount
34:
35:  Open the avi file
36:     anmShowAction.Open strAvi_Filename
37:
38:  Open the source and destination files
39:     Open strFrom_filename For Binary As #1
40:     Open strTo_filename For Binary As #2
41:
42:  Set the label to display the file being copied
43:  and make all of the related controls visible
44:     lblDisplay.Caption = Copying..  & strFrom_filename
45:     lblDisplay.Visible = True
46:     anmShowAction.Visible = True
47:     prgStatus.Visible = True
48:
49:  Start the animation
50:     anmShowAction.Play
51:
52:  This routine loops until the entire file is copied
53:     For intLoopCtr = 1 To i + 1
54:         Get #1, , strInByte
55:         Put #2, , strInByte

 
< previous page page_43 next page >

If you like this book, buy it!